package leetcode1;

//轮转数组
public class leetcode189 {
    class Solution {
        public void rotate(int[] nums, int k) {
            int[]numsCopy=new int[nums.length];
            for (int i = 0; i < nums.length; i++) {
                numsCopy[(i+k)%nums.length]=nums[i];
            }
            for (int i = 0; i < numsCopy.length; i++) {
                nums[i]=numsCopy[i];
            }
        }
    }
}
